//
//  GYHomeMarketViewModel.m
//  GYDemo
//
//  Created by Mrzhang on 2018/3/29.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "GYHomeMarketViewModel.h"
#import "Head.h"
@implementation GYHomeMarketInfoModel

@end

@implementation GYHomeMarketViewModel
#pragma mark - getter and setter
-(NSMutableArray *)datas
{
    if (!_datas) {
        _datas = [NSMutableArray new];
    }
    return _datas;
}

#pragma mark - method
-(void)requestDatas:(NSMutableDictionary *)para
{
    @WeakSelf;
    NSString *interface = @"markertCenter";
    NSString *page = para[@"page"];
    [[InterfaceManager shareInterface]requetInterface:interface withParameter:para handler:^(NSDictionary *info, InterfaceStatusModel *infoModel) {
        NSDictionary *data = infoModel.data;
        if ([data isKindOfClass:[NSDictionary class]])
        {
            NSArray *datalist = data[@"datalist"];
            if ([datalist isKindOfClass:[NSArray class]]) {

                NSMutableArray *arr;
                if ([page isEqualToString:@"1"]) {
                    arr = [NSMutableArray new];
                }else{
                    arr = _datas;
                }
                
                for (NSDictionary *dic in datalist) {
                    GYHomeMarketInfoModel *model = [GYHomeMarketInfoModel yy_modelWithJSON:dic];
                    [arr addObject:model];
                }
                [selfp setDatas:arr];
                
            }
            
        }

    }];
}

@end
